#include "TCPConnection.h"
#include "Protocol.h"
#include "database/Client.hpp"

void CSProtocol::Logout::receiveTreat(TCPConnection &connexion, IData *udata)
{
  CSProtocol::Login *data = static_cast<CSProtocol::Login*>(udata);
  if (!data)
    return;
  connexion.setAuthenticate(false);
  connexion.setClient(NULL);
  CSProtocol::Header header = CSProtocol::Header();
  header.spontaneous = false;
  header.code = CSProtocol::Ok::code;
  CSProtocol::Ok command = CSProtocol::Ok();
  IData *pcmd;
  pcmd = &command;
  strcpy(command.what, "Logout succesfull.");
  header.dataLength = sizeof(CSProtocol::Ok);
  connexion.write(header, *pcmd);
}

void CSProtocol::Logout::sendTreat(TCPConnection &connexion)
{

}
